# conding = utf-8
from selenium.webdriver import ActionChains, Keys

from pages.page import Page
from pages.xgz.urse import *

class Urse(Page):

    # 查询UI测试
    def open_admin(self):
        '''
        打开管理员UI，如果已经打开则不会执行单击动作
        :return:
        '''
        if self.display(leftmenu) is False:
            self.click(leftmenu_sys)
        self.click(leftmenu)


##查询输入第一个框
    def role_addc(self,value):
        self.send_keys(role_add,value)

    #单击重置
    def reset_selectc(self):
        self.click(reset_select)

    #点击查询
    def check_selectc(self):
        self.click(check_select)

    #输入第二个框
    def two_selectc(self,value):
        self.send_keys(two_select,value)

    #查询断言
    def query_select(self):
        return self.text(query_select)




    #批量操作
    #打钩
    def tick_batchc(self):
        self.click(tick_batch)

    #批量操作
    def operate_batch(self):
        self.click(operate_batch)

    #禁用
    def disable_batch(self):
        self.click(disable_batch)

    #启用
    def enable_batch(self):
        self.click(enable_batch)

    #确定
    def sure_batch(self):
        self.click(sure_batch)



    #添加
    def newly_added(self):
        self.click(newly_added)

    #角色名称
    def first_added(self,value):
        self.send_keys(first_added,value)

    # 保存角色名称
    def first_addedcq(self):
        return self.get_input_value(first_added)

    #第二个输入框
    def the_added(self,value):
        self.send_keys(the_added,value)


    #第三个输入框
    def third_added(self):
        self.click(third_added)
        actions = ActionChains(self.driver)  # 定义动作链
        actions.send_keys(Keys.DOWN)  # 下键
        actions.send_keys(Keys.ENTER)  # 回车键
        actions.perform()

    #点击确定
    def sure_added(self):
        self.click(sure_added)

    #关闭
    def close_added(self):
        self.click(close_added)

    #刷新页面
    def windowsreset(self):
        self.driver.refresh()

    # 结果
    def result_added(self):
        return self.text(result_added)



    # 编辑
    def edit_edit(self):
        self.click(edit_edit)

    # 输入角色名称
    def first_edit(self, value):
        self.send_keys(first_edit, value)

    # 保存角色名称
    def first_editc(self):
        return self.get_input_value(first_edit)

    # 结果
    def assertion_edit(self):
        return self.text(assertion_edit)

    # 确定
    def sure_edit(self):
        self.click(sure_edit)

    #取消
    def close_edit(self):
        self.click(close_edit)



    #重置密码
    def reset_password(self):
        self.click(reset_password)

    #确定
    def confirm_password(self):
        self.click(confirm_password)

    #断言
    def assert_password(self):
        return self.is_exists(assert_password)






        # 删除
    def delete_delete(self):
        self.click(delete_delete)

        # 点击确定
    def click_delect(self):
        self.click(click_delect)

        # 删除的断言
    def assertion_delect(self):
        return self.text(click_delect)
